package io.github.jhipster.sample.domain;

import static io.github.jhipster.sample.domain.AssertUtils.bigDecimalCompareTo;
import static org.assertj.core.api.Assertions.assertThat;

public class BankAccountAsserts {

    /**
     * Asserts that the entity has all properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertBankAccountAllPropertiesEquals(BankAccount expected, BankAccount actual) {
        assertBankAccountAutoGeneratedPropertiesEquals(expected, actual);
        assertBankAccountAllUpdatablePropertiesEquals(expected, actual);
    }

    /**
     * Asserts that the entity has all updatable properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertBankAccountAllUpdatablePropertiesEquals(BankAccount expected, BankAccount actual) {
        assertBankAccountUpdatableFieldsEquals(expected, actual);
        assertBankAccountUpdatableRelationshipsEquals(expected, actual);
    }

    /**
     * Asserts that the entity has all the auto generated properties (fields/relationships) set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertBankAccountAutoGeneratedPropertiesEquals(BankAccount expected, BankAccount actual) {
        assertThat(actual)
            .as("Verify BankAccount auto generated properties")
            .satisfies(a -> assertThat(a.getId()).as("check id").isEqualTo(expected.getId()));
    }

    /**
     * Asserts that the entity has all the updatable fields set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertBankAccountUpdatableFieldsEquals(BankAccount expected, BankAccount actual) {
        assertThat(actual)
            .as("Verify BankAccount relevant properties")
            .satisfies(a -> assertThat(a.getName()).as("check name").isEqualTo(expected.getName()))
            .satisfies(a ->
                assertThat(a.getBalance()).as("check balance").usingComparator(bigDecimalCompareTo).isEqualTo(expected.getBalance())
            );
    }

    /**
     * Asserts that the entity has all the updatable relationships set.
     *
     * @param expected the expected entity
     * @param actual the actual entity
     */
    public static void assertBankAccountUpdatableRelationshipsEquals(BankAccount expected, BankAccount actual) {
        // empty method
    }
}
